package com.example.supplychainbackend.mapper;

import com.example.supplychainbackend.controller.dto.purchase.*;
import com.example.supplychainbackend.entity.purchase.PurchaseContractEntity;
import com.example.supplychainbackend.entity.purchase.PurchaseMaterialEntity;
import com.example.supplychainbackend.entity.purchase.PurchaseOrderEntity;
import com.example.supplychainbackend.entity.purchase.PurchaseRequireEntity;
import org.mapstruct.Builder;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;

import java.util.List;

@Mapper(componentModel = "spring",
        builder = @Builder(disableBuilder = true),
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface PurchaseMapper {
    PurchaseRequireDto toPurchaseRequireDto(PurchaseRequireEntity entity);
    PurchaseRequireEntity toPurchaseRequireEntity(PurchaseRequireDto dto);
    List<PurchaseRequireDto> toPurchaseRequireDtoList(List<PurchaseRequireEntity> entities);
    void updateFromDto(@MappingTarget PurchaseRequireEntity entity, PurchaseRequireDto dto);

    PurchaseOrderDto toPurchaseOrderDto(PurchaseOrderEntity entity);
    PurchaseOrderEntity toPurchaseOrderEntity(PurchaseOrderDto dto);
    List<PurchaseOrderDto> toPurchaseOrderDtoList(List<PurchaseOrderEntity> entities);
    void updateFromDto(@MappingTarget PurchaseOrderEntity entity, PurchaseOrderDto dto);
    PurchaseMaterialDto toPurchaseMaterialDto(PurchaseMaterialEntity entity);
    PurchaseMaterialEntity toPurchaseMaterialEntity(PurchaseMaterialDto dto);
    List<PurchaseMaterialDto> toPurchaseMaterialDtoList(List<PurchaseMaterialEntity> entities);
    void updateFromDto(@MappingTarget PurchaseMaterialEntity entity, PurchaseMaterialDto dto);

    List<PurchaseContractPODto> toPurchaseContractPODtoList(List<PurchaseOrderEntity> entities);

    PurchaseContractDto toPurchaseContractDto(PurchaseContractEntity entity);
    PurchaseContractEntity toPurchaseContractEntity(PurchaseContractDto dto);
    List<PurchaseContractDto> toPurchaseContractDtoList(List<PurchaseContractEntity> entities);
    void updateFromDto(@MappingTarget PurchaseContractEntity entity, PurchaseContractDto dto);
}
